import { Button } from "antd"

export default function StockTable({ data, reportDate, onAskAI }: any) {
    return (
        <table className="w-full text-sm border">
            <thead className="bg-gray-100">
                <tr>
                    <th className="p-2 text-left">股票</th>
                    <th className="p-2 text-left" colSpan={2}>所属行业</th>
                </tr>
            </thead>

            <tbody>
                {data.map((stock: any) => (
                    <tr key={stock.code} className="border-t">
                        <td className="p-2">
                            <div>{stock.shortName}</div>
                            <div className="text-xs text-gray-500">{stock.code}</div>
                        </td>
                        <td className="p-2">{stock.industryName}</td>
                        <td className="p-2 text-center">
                            <Button
                                onClick={() => onAskAI(stock, reportDate)}
                                type="primary"
                                size="small"
                            >
                                基本面
                            </Button>
                        </td>
                    </tr>
                ))}
            </tbody>
        </table>
    )
};